package controls
{
	import flash.events.KeyboardEvent;
	import flash.ui.Keyboard;
	
	import mx.controls.TextInput;

	public class TextInputEx extends TextInput
	{
		public function TextInputEx()
		{
			super();
		}
		
		private var prevText:String;
		protected override function keyUpHandler(event:KeyboardEvent):void
		{
			super.keyUpHandler(event);		
			
			if ( event.keyCode == Keyboard.BACKSPACE )
			{	
				if( textField.text.length == 0 )
					return;				

				if ( prevText == textField.text )
				{
					textField.text = textField.text.slice(0, textField.selectionBeginIndex) + textField.text.slice(textField.selectionBeginIndex+1);  
					text = textField.text;
					commitProperties();
					prevText = null;												
				} 				
				prevText = textField.text;
			}
			else
			{
				prevText = textField.text;
			}
		}
		
		
	}
}